#define  _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
int main()
{
    int n = 0;
    scanf("%d", &n);
    int i = 0, j = 0, k = 0;
    int arr[100] = { 0 };
    int temp[100] = { 0 };
    for (i = 0; i < n; i++)
        scanf("%d", &arr[i]);
    int m = 0;
    scanf("%d", &m);
    for (i = n - m; i < n; i++)
        temp[j++] = arr[i];
    for (i = n - m - 1; i >= 0; i--)
        arr[i + m] = arr[i];
    for (i = 0; i < m; i++)
        arr[i] = temp[i];
    for (i = 0; i < n; i++)
        printf("%d ", arr[i]);
    return 0;
}